#include "StdAfx.h"
#include "Source.h"
#include "OceanViewFactory.h"


CSource::CSource(int iPower, int outAmount, double* outs):CGtsNode(0, outAmount, outs)
{
	this->setPower(iPower);	
    view = (new OceanViewFactory())->createSourceView();
}


CSource::~CSource()
{
}

void CSource::correctState()
{
	double result = (getPower()-getOutFlow())/getPower();
	if(result<=0.2)
		iState=NORMAL_STATE;
	else if(result>0.4)
		iState=CRITICAL_STATE;
	else
		iState=WARNING_STATE;
}
